<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	String contextPath = request.getContextPath();
%>
<jsp:include page="/WEB-INF/jsp/common/fadeout.jsp"></jsp:include>
<style scoped="scoped">
        .textbox{
            height:20px;
            margin:0;
            padding:0 2px;
            box-sizing:content-box;
        }
    </style>
<style type="text/css">
	table tr td{
		align:left;
	}
</style>
<div id="add_pro" class="easyui-layout" data-options="fit:true">  
    <div data-options="region:'center',split:false" style="padding:30px;">
    	<h2 align="center"></h2>
    	<form id="add_pro_form" method="post">
    	<table align="center">
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    	    <tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
    		<tr><td></td><td></td></tr>
<!--     		<tr> -->
<!--     			<td><label for="pro_no">商品编号:</label></td>    -->
<!--         		<td><input class="easyui-validatebox textbox" data-options="required:true,missingMessage:'请输入商品编码'" name='pro_no' /></td> -->
<!--     		</tr> -->
    		<tr>
    			<td><label for="pro_name">商品名称:</label></td>   
        		<td><input class="easyui-validatebox textbox" data-options="required:true,missingMessage:'请输入商品名称'" name='pro_name' /></td>
    		</tr>
    		<tr>
    			<td><label for="customer_no">客户编码:</label></td>  
    			<td><input id = "csno" data-options="required:true,editable:false,missingMessage:'请输入客户编码'" name='customer_no' /></td>
    		</tr>
    		<tr>
    			<td><label for="warehouse">有效仓位:</label></td>  
    			<td>
    			<select class="easyui-combobox" name="warehouse" id="warehouseId" data-options="required:true,editable:false,missingMessage:'请选择有效仓位',panelHeight:'auto'"style="width:142px">
								<option value="德州仓">德州仓</option>
								<option value="美东MAINE仓">美东MAINE仓</option>
								<option value="芝加哥仓">芝加哥仓</option>
				</select>
    			</td>
    		</tr>
    		<tr>
    			<td><label for="location">区位:</label></td>  
    			<td><input class="easyui-validatebox textbox" data-options="required:true,missingMessage:'请输入区位'" name='location' /></td>
    		</tr>
    		<tr>
    			<td><label for="loc_no">库位号:</label></td>  
    			<td><input class="easyui-validatebox textbox" data-options="required:true,missingMessage:'请输入库位号'"name='loc_no' /></td>
    		</tr>
    		<tr>
			<td>尺寸</td>
			<td  colspan="4">长&nbsp;<input type="text" class="easyui-validatebox textbox" data-options="required:true,validType:'mone',missingMessage:'请输入长度'"size="8" name="length"/>
				&nbsp;&nbsp;&nbsp;宽
			     &nbsp;<input type="text" size="8" class="easyui-validatebox textbox" data-options="required:true,validType:'mone',missingMessage:'请输入宽度'"name="width"/>&nbsp;&nbsp;&nbsp;
			       高&nbsp;<input type="text" size="8" class="easyui-validatebox textbox" data-options="required:true,validType:'mone',missingMessage:'请输入高度'"name="height"/>&nbsp;&nbsp;&nbsp;(单位：inch)</td>
			</tr>
    		<tr>
    			<td><label for="weight">重量:</label></td>  
    			<td><input class="easyui-validatebox textbox" data-options="required:true,validType:'mone',missingMessage:'请输入重量'"name='weight' />&nbsp;&nbsp;&nbsp;LB</td>
    		</tr>
<!--     		<tr> -->
<!--     			<td><label for="pre_postage">预估邮费:</label></td>   -->
<!--     			<td><input class="easyui-validatebox textbox" data-options="required:true,validType:'money',missingMessage:'请输入预估邮费'"name='pre_postage' />&nbsp;&nbsp;&nbsp;(美金)</td> -->
<!--     		</tr> -->
<!--     		<tr> -->
<!--     			<td><label for="pro_number">数量:</label></td>   -->
<!--     			<td><input class="easyui-validatebox textbox" data-options="required:true,missingMessage:'请输入数量'"name='pro_number' /></td> -->
<!--     		</tr> -->
<tr>
			<td>图片</td>
<!-- 			<td  colspan="4"><input type="file" name="file_name"></td> -->
			<td  colspan="1"><input type="file" id="file_upload" /></td>
		</tr>
    	</table>
    	<input type="hidden"  name="image_name"/>
    	</form>
    </div>

	<div data-options="region:'south',split:false" style="height:60px;background:#95B8E7;text-align:center;padding:10px;">
		<a href="javascript:void(0);" onclick="savepro()" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</a>&nbsp;&nbsp;&nbsp;
	</div> 
</div>  
<script>
$("#file_upload").uploadifive({
	'buttonText' : '请选择',
	'height' : 20,
	'uploadScript' : 'upload/submit.do',
	//上传文件类型编码，具体可见 http://www.cnblogs.com/anllin/articles/1994485.html
	'fileType' : 'image',
	'width' : 120,
	'auto' : true,//设置选择文件后是否自动上传
	'removeCompleted' : false,
	'fileObjName' : 'file',
	'onUploadComplete' : function(file, data) {
		var data = eval("(" + data + ")");
		if (data.success) {
			$("input[name='image_name']").val(data.result);
		} 
		$.messager.alert('提示',data.msg);
	}
});


$('#csno').combobox({    
	url:'admin/system/allCustomerNos.do',    
	valueField:'text',    
	textField:'text',
	required:true,
	panelHeight:'auto'
});
            function savepro(){
            	$('#add_pro_form').form({    
            	    url:'repertory_manager/subPro.do',    
            	    onSubmit: function(param){    
            	    	var isValid = $(this).form('validate');
            			return isValid;	// 返回false终止表单提交
            	    },    
            	    success:function(data){ 
            	    	var data = eval('(' + data + ')');  
            	    	$.messager.alert('提示',data.msg);
            	    	$("#add_pro_form input[name='pro_name']").val('');
            	    	$("#add_pro_form input[name='location']").val('');
            	    	$("#add_pro_form input[name='loc_no']").val('');
            	    	$("#add_pro_form input[name='length']").val('');
            	    	$("#add_pro_form input[name='width']").val('');
            	    	$("#add_pro_form input[name='height']").val('');
            	    	$("#add_pro_form input[name='weight']").val('');
            	    	//$("#warehouseId").val('德州仓');
            	    	$("#pro_bycsno_datagrid").datagrid('reload');
            	    }    
            	});    
            	$('#add_pro_form').submit();  
            }
</script>